﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Vim25Api;

namespace Wicresoft.EKA.VCenter.Tests
{
    [TestClass]
    public class ConnectionTest
    {
        [TestMethod]
        public void TestMethod1()
        {

            //OptionSpec url = new OptionSpec("url", "https://192.168.85.208/sdk");
            //OptionSpec url = new OptionSpec("url", "https://192.168.85.191/sdk");
            OptionSpec url = new OptionSpec("url", "https://192.168.1.114/sdk");
            // OptionSpec userName = new OptionSpec("userName", "Administrator");
            OptionSpec userName = new OptionSpec("userName", "root");
            OptionSpec password = new OptionSpec("password", "Pass01!");

            ExtendedAppUtil app = ExtendedAppUtil.Initialize("Test", new OptionSpec[] { url, userName, password });
            app.Connect();
            ManagedObjectReference mo = app.ServiceUtilV25.GetDecendentMoRef(null, "VirtualMachine", "Data");
            Console.WriteLine(app.ServiceUtilV25.GetObjectProperty(mo, "summary.name"));
            Console.WriteLine(app.ServiceConnectionV25.ServiceContent.rootFolder);
            //ManagedObjectReference mo = app.ServiceUtilV25.GetDecendentMoRef(null, "VirtualMachine", "Test");
            ////app.ServiceConnectionV25.Service.PowerOnVM_Task(mo,null);
            ////app.ServiceConnectionV25.Service.PowerOffVM_Task(mo);
            //Console.WriteLine(DateTime.Now.ToString());
            //for (int i = 0; i < 100; i++)
            //{
            //    Console.WriteLine(app.ServiceUtilV25.GetObjectProperty(mo, "guest.toolsVersionStatus").ToString()+i.ToString());
            //}
        }
    }
}
